home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / amislate / slaterexx / flower.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-05  |  1KB  |  59 lines

  1. /* An Arexx script for use with AmiSlate:  
  2.  
  3.    Draws a pretty multicolored flowery pattern on the AmiSlate window
  4. */
  5. parse arg CommandPort ActiveString
  6.  
  7. address (CommandPort)
  8.  
  9. if (length(CommandPort) == 0) then do
  10.     say ""
  11.     say "Usage:  rx flower.rexx <REXXPORTNAME>"
  12.     say "        (REXXPORTNAME is usually AMISLATE)"
  13.     say ""
  14.     say "Or run from the Rexx menu within AmiSlate."
  15.     say ""
  16.     exit 0
  17.     end
  18.  
  19. options results
  20.  
  21. x=15
  22. y=15
  23. dx=0
  24. dy=0
  25. nsteps = 1000
  26. nscale = 16/1000
  27.  
  28.  
  29. /* Necessary for "delay" to work */ 
  30. check = addlib('rexxsupport.library', 0, -30, 0)
  31.  
  32. penreset
  33.  
  34. /* Draw a black box around the window border */
  35. newpen = setfcolor 0 0 0
  36. GetWindowAttrs stem win.
  37.  
  38. /* Note that GetWindowAttrs returns the size of the whole window including
  39.    the ToolBar, Palette, Chat Lines, Title, and everything else.  To just
  40.    draw to the border of the drawing area, we need to subtract the constants
  41.    below.  */
  42. square 0 0 (win.width - 58) (win.height - 53)
  43.  
  44. /* Calculate center of drawing area */
  45. mx = trunc((win.width-58)/2)
  46. my = trunc((win.height-53)/2)
  47.  
  48. do while (1)
  49.     pen x y
  50.     if (x < mx) then dx = dx + 1
  51.     if (x > mx) then dx = dx - 1
  52.     if (y < my) then dy = dy + 1
  53.     if (y > my) then dy = dy - 1
  54.  
  55.     x = x + dx
  56.     y = y + dy
  57.     xx = delay(1)
  58.     setfcolor trunc(random()*nscale) trunc(random()*nscale) trunc(random()*nscale) notbackground
  59. end